﻿<UserControl x:Class="GBlason.Control.Aggregate.Properties"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Properties="clr-namespace:GBlason.Properties"
             xmlns:TemplateSelector="clr-namespace:GBlason.Common.TemplateSelector"
             xmlns:Custom="clr-namespace:GBlason.Common.CustomCommand" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <TemplateSelector:PropertyTable x:Key="cellTemplateSelectorForProperties"/>
    </UserControl.Resources>
    <UserControl.CommandBindings>
        <CommandBinding Command="Custom:CommandMenu.ChangingShape" CanExecute="CommandBindingCanExecute"
                        Executed="ShapeChangingExecuted"/>
        <CommandBinding Command="Custom:CommandMenu.ChangingColor" CanExecute="CommandBindingCanExecute"
                        Executed="ColorChangingExecuted"/>
    </UserControl.CommandBindings>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" MinHeight="20" MaxHeight="32"/>
            <RowDefinition Height="Auto" MinHeight="30"/>
            <RowDefinition Height="28"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0"
                Background="{StaticResource ResourceKey=UserControlHeaderBackgroundBrush}"
                CornerRadius="0"
                Margin="0"
                BorderThickness="1"
                BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}">
            <Border Margin="0"
                    CornerRadius="0"
                    BorderThickness="1"
                    BorderBrush="{StaticResource ResourceKey=LightColorBorderBrush}">
                <DockPanel>
                    <TextBlock Text="{x:Static Properties:Resources.ControlPropertyTitle}"
                       VerticalAlignment="Center" HorizontalAlignment="Left"
                       Margin="10,0,2,0"/>
                </DockPanel>
            </Border>
        </Border>
        <Border x:Name="DataProperty"
                Grid.Row="1"
                BorderThickness="1,0,1,0"
                BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}"
                Background="{StaticResource ResourceKey=DarkColorBackgroundBrush}">
            <DockPanel Background="#AAFFFFFF">
                <Border DockPanel.Dock="Right" Height="28" Width="28"
                           Background="White" Margin="4"
                        BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}"
                        BorderThickness="1">
                    <Image Source="..\..\Pictures\Icons16\construction.png" Height="16" Width="16"/>
                </Border>
                <TextBlock Text="{Binding Path=ComponentName}" VerticalAlignment="Center" HorizontalAlignment="Left"
                           Margin="15,0,0,2" FontSize="13" Foreground="{DynamicResource ResourceKey=CustomGuiDarkBlueForeground}"
                           DockPanel.Dock="Bottom"/>
            </DockPanel>
        </Border>
        <Border x:Name="DropShadowHeader"
                Height="4" VerticalAlignment="Top"
                Margin="1,0"
                Background="{StaticResource ResourceKey=UserControlHeaderDropingShadow}"
                Grid.Row="1">
        </Border>
        <Border Grid.Row="2"
                Background="{StaticResource ResourceKey=UserControlHeaderBackgroundBrush}"
                CornerRadius="0"
                Margin="0"
                BorderThickness="1,1,1,0"
                BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}">
            <Border Margin="0"
                    CornerRadius="0"
                    BorderThickness="1,1,1,0"
                    BorderBrush="{StaticResource ResourceKey=LightColorBorderBrush}">
                <DockPanel>
                    <TextBox x:Name="SearchPropertiesTextBox" Margin="2"
                             MinWidth="60"
                             Width="160"
                             MaxWidth="160" DockPanel.Dock="Right"
                             Height="22"></TextBox>
                    <Image Source="..\..\Pictures\Icons16\filter.png" Width="16" Height="16" DockPanel.Dock="Right"
                           Margin="4,0,2,0"/>
                    <Border Background="Transparent" />
                </DockPanel>
            </Border>
        </Border>
        <Grid Grid.Row="3">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="6"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="6"/>
            </Grid.ColumnDefinitions>
            <Border Grid.Column="0"
                    Background="{StaticResource ResourceKey=DarkColorBackgroundBrush}"
                    BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}"
                    BorderThickness="1,0,0,1">
                <Border x:Name="InnerBorderBottomLeft"
                        BorderBrush="{StaticResource ResourceKey=LightColorBorderBrush}"
                        BorderThickness="1,0,0,1"
                        Margin="0,0,0,1"/>
            </Border>
            <Border Grid.Column="2"
                    Background="{StaticResource ResourceKey=DarkColorBackgroundBrush}"
                    BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}"
                    BorderThickness="0,0,1,1">
                <Border x:Name="InnerBorderBottomRight"
                        BorderBrush="{StaticResource ResourceKey=LightColorBorderBrush}"
                        Margin="1,0,0,0"
                        BorderThickness="0,0,1,1"/>
            </Border>
            <Border Grid.Column="1" Background="{StaticResource ResourceKey=DarkColorBackgroundBrush}">
                <Border x:Name="FieldContainerLightBorder"
                        Margin="-2,0,-2,1"
                        CornerRadius="2,2,0,0"
                        BorderThickness="1,1,1,0"
                         BorderBrush="{StaticResource ResourceKey=LightColorBorderBrush}">
                    <Border x:Name="FieldContainerDarkBorder"
                        Margin="0"
                        CornerRadius="2,2,0,0"
                        BorderThickness="1,1,1,0"
                         BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}"/>
                </Border>
            </Border>
            <Border x:Name="ContentBackground"
                    Grid.Column="1"
                    Margin="0,2,0,0"
                    CornerRadius="2,2,0,0"
                    Background="#AAFFFFFF">
                <ScrollViewer VerticalScrollBarVisibility="Auto"
                              HorizontalScrollBarVisibility="Disabled"
                              HorizontalAlignment="Stretch">
                    <DataGrid HeadersVisibility="None"
                              BorderThickness="0,0,0,1"
                              Background="Transparent"
                              RowBackground="Transparent"
                              BorderBrush="{StaticResource ResourceKey=DarkColorBorderBrush}"
                              x:Name="PropertiesDataGrid"
                              ItemsSource="{Binding Path=PropertiesData}"
                              AllowDrop="False" AutoGenerateColumns="False"
                              CanUserAddRows="False" CanUserDeleteRows="False"
                              CanUserReorderColumns="False" CanUserResizeColumns="True"
                              CanUserSortColumns="True" SelectionMode="Single" SelectionUnit="FullRow"
                              HorizontalGridLinesBrush="{StaticResource ResourceKey=HorizontalSeparatorBrush}"
                              VerticalGridLinesBrush="Transparent"
                              CellStyle="{DynamicResource ResourceKey=DataGridCellStyle}"
                              >
                        <DataGrid.Columns>
                            <DataGridTemplateColumn x:Name="PropertyNameColumn"
                                                    MinWidth="100" Width="Auto">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center"
                                                   Margin="4,1"
                                                   Text="{Binding Path=PropertyName}" Foreground="Black"/>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn x:Name="PropertyValueColumn" CanUserResize="True" CanUserSort="False"
                                                    CellTemplateSelector="{StaticResource ResourceKey=cellTemplateSelectorForProperties}"
                                                    Width="*"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </ScrollViewer>
            </Border>
            <Border x:Name="DropShadowContent"
                    Height="4" VerticalAlignment="Top"
                    Margin="0,2"
                    CornerRadius="2,2,0,0"
                    Background="{StaticResource ResourceKey=UserControlHeaderDropingShadow}"
                    Grid.Column="1">
            </Border>
        </Grid>
    </Grid>
</UserControl>
